<?php
 defined('RUN')or die('No access');class Pagination{private static $a;public static function getTotalPages($b,$c){return floor(($b-1)/$c)+1;}public static function set($d,$b,$c,$e,$f){$g=self::getTotalPages($b,$c);$h=array('total'=>$g,'pages'=>array(),'current'=>$f,'prev'=>($f==1)?0:$f-1,'next'=>($f==$g)?0:$f+1);for($j=1;$j<=$g;$j++){if($j==1){$h['pages'][]=1;}else if($j==$g){$h['pages'][]=$j;}else if($j>=($f-$e/2)&&$j<=($f+$e/2)){$h['pages'][]=$j;}else{$k=count($h['pages']);if($h['pages'][$k-1]!=0){$h['pages'][]=0;}}}self::$a[$d]=$h;}public static function get($d){if(array_key_exists($d,self::$a)){return self::$a[$d];}return FALSE;}public static function remove($d){if(array_key_exists($d,self::$a)){unset(self::$a[$d]);return TRUE;}return FALSE;}}